<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>

<script type="text/javascript">
	var userregisterid;
	$(function() {

		userregisterid = $('#userregisterid')
				.datagrid(
						{
							//title : '列表',
							url : '${ctx}/autoinn/userRegister/list',
							striped : true,
							rownumbers : true,							
							pagination : true,
							singleSelect : true,
							idField : 'id',						
							sortName : 'id',
							sortOrder : 'desc',
							pageSize : 50,
							pageList : [ 10, 20, 30, 40, 50, 100, 200, 300,
									400, 500 ],
							frozenColumns : [ [ 
							{
								width : '120',
								title : '用户名称',
								field : 'nickname',
							
							} ] ],
							columns : [ [
									{
										width : '130',
										title : '手机号码',
										field : 'phone',
										
									},
									{
										width : '90',
										title : '品牌',
										field : 'brand',																				
									},
									{
										width : '130',
										title : '车型',
										field : 'motorcycle',

									},
									{
										width : '60',
										title : '状态',
										field : 'state',
										formatter : function(value, row) {
											if (value==0) {
												return sy.formatString("<span align='center'>已联系</span>");
											} else {
												return sy.formatString("<span align='center'>未联系</span>");
											}
										}
									},
									{
										width : '125',
										title : '创建时间',
										field : 'createime'
									},
									{
										width : '150',
										title : '操作',
										field : 'action',
										formatter : function(value, row) {
											var str="";
										if(row.state==0){
											str+="<input type='button' onclick='updatephne(\""+row.id+"\");' value='未联系'/>";
											
										}else{
											str+= "<input type='button'  value='已联系'/>";
											
										}
										str+="<span style='cursor:pointer;' onclick='userregisterform(\""+row.id+"\")'>【查看保险凭证】</span>";
										return str;
										
								}
									} ] ],
							toolbar : '#usergistertoolbar',
							onBeforeLoad : function(param) {
								parent.$.messager.progress({
									text : '数据加载中....'
								});
							},
							onLoadSuccess : function(data) {
								
								parent.$.messager.progress('close');
							}

						});
	});

	
	//修改联系方式
	var updatephne = function(id){
		
			parent.$.messager.confirm('询问', '您确定要修改？', function(r) {
				if (r) {
					$.post('${ctx}/autoinn/userRegister/update/pro/' + id, {
						id : id
					}, function(data) {
						
						userregisterid.datagrid('reload');
						$.messager.alert(
								'温馨提示',
								data.message);
					}, 'json');
				}
			});
	
		
		
	};
	
	//查看保单
	var userregisterform = function(id) {
		$('<div/>')
				.dialog(
						{
							href : '${ctx}/autoinn/userRegister/detail/' + id,
							width : 740,
							height : 380,
							modal : true,
							title : '保单详情',
							buttons : [ {
								text : '关闭',
								iconCls : 'icon-add',
								handler : function() {
									var d = $(this).closest('.window-body');
								
     								d.dialog('destroy');
													

								}

							} ],
							onLoad : function() {
								//$("#res_updateForm").form('load',entity);
							
							},
							onClose : function() {
								$(this).dialog('destroy');
							}
						});

	};
	
		

	
</script>








<!-- 界面布局  -->

<div class="easyui-layout" style="width: 100%; height: 100%;"
	data-options="fit:true,border:false">

	<div id="usergistertoolbar" style="display: none;">

		<table>
			<tr>
				<td>
					<!-- <form id="userregister_updateForm">
						<table>
						
							<tr style="font-size: 13px;">
								<td>用户名称</td>
								<td><input name="nickname" style="width: 80px;" /></td>
								 <td>发放类型</td>
								<td><select name="couponZhi" style="width:150px">
								<option value="">--请选择--</option>
								<option value="0">绑定送券</option>
								<option value="1">充值送券</option>
								<option value="2">消费送券</option>
								<option value="3">人工送券</option>
								</select></td>
								 <td>状态</td>
								<td><select name="state">
								<option value="">--请选择--</option>
								  <option value="1">启用</option>
								  <option value="0">未启用</option>
								</select></td>
							  <td>
							  领取时间：
							  </td>	
							 <td>
							   <input name="starinnertime" class="Wdate"
									onclick="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
									readonly="readonly" style="width: 120px;" />-<input
									name="endinnertime" class="Wdate"
									onclick="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
									readonly="readonly" style="width: 120px;" /></input>
							  </td>

								 <td><a href="javascript:void(0);" class="easyui-linkbutton"
									data-options="iconCls:'icon-search',plain:true"
									onclick="userregisterid.datagrid('load',sy.serializeObject($('#couponsearchForm')));">过滤</a><a
									href="javascript:void(0);" class="easyui-linkbutton"
									data-options="iconCls:'icon-reload',plain:true"
									onclick="$('#couponsearchForm input').val('');userregisterid.datagrid('load',{});">重置过滤</a></td>
							</tr>
						</table>
						
					</form> -->
				</td>
			</tr>
			<tr>
				<td>
					
				</td>
			</tr>
		</table>
	</div>
	<div data-options="region:'center',title:'用户信息管理'" style="padding: 2px;">
		<div class="easyui-layout" data-options="fit : true,border : false">
			<div data-options="region:'center',border:false">
				<table id="userregisterid" data-options="fit:true,border:false"></table>
			</div>
		</div>
	</div>

</div>
